package com.fyp.ptma.android.client;

public enum OS {
	WINDOWS, MAC,LINUX,	SOLARISE,NOT_SUPPPRTED;
	private static String OS = System.getProperty("os.name").toLowerCase();

	public static OS getOS() {
		if (isWindows()) {
			System.out.println("This is Windows");
			return WINDOWS;
		} else if (isMac()) {
			System.out.println("This is Mac");
			return MAC;
		} else if (isUnix()) {
			System.out.println("This is Unix or Linux");
			return LINUX;
		} else if (isSolaris()) {
			System.out.println("This is Solaris");
			return SOLARISE;
		} else {
			return NOT_SUPPPRTED;
		}
	}

	private static boolean isWindows() {

		return (OS.indexOf("win") >= 0);

	}

	private static boolean isMac() {

		return (OS.indexOf("mac") >= 0);

	}

	private static boolean isUnix() {

		return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS
				.indexOf("aix") > 0);

	}

	private static boolean isSolaris() {

		return (OS.indexOf("sunos") >= 0);

	}
}
